require('zerenity/entry')

class TC_Entry < Test::Unit::TestCase
  def setup
    Gtk.init
    @options = {:title=>"Enter your name",:text=>"Enter your name"}
    @vbox = Gtk::VBox.new
  end

  def test_build_normal
    Zerenity::Entry.build(@vbox,@options)
    assert_equal(true,@vbox.children[1].visibility?)
  end

  def test_build_password
    @options[:password] = true
    Zerenity::Entry.build(@vbox,@options)
    assert_equal(false,@vbox.children[1].visibility?)
  end

  def test_check_normal
    Zerenity::Entry.check(@options)
    assert(!@options[:password])
    @options[:password] = true
    Zerenity::Entry.check(@options)
    assert(@options[:password])
  end

  def test_retrieve_selection_normal
    Zerenity::Entry.build(@vbox,@options)
    @vbox.children[1].text = "Farrel"
    assert_equal("Farrel",Zerenity::Entry.retrieve_selection(@vbox,@options))
  end
end
